package br.org.acessobrasil.portal.persistencia;

import java.util.List;

import org.apache.log4j.Logger;

import br.org.acessobrasil.portal.modelo.Setor;
import br.org.acessobrasil.portal.modelo.Sitio;
public class SetorDao extends SuperDao<Setor>{
	private static Logger logger = Logger.getLogger(SetorDao.class);
	public SetorDao(){
		logger.info("SetorDao instanciado...");
	}
	@SuppressWarnings("unchecked")
	public List<Setor> getListSetor() {
		return getEntityManager().createQuery("Select s From Setor s").getResultList();
	}
	
	@Deprecated
	@SuppressWarnings("unchecked")
	public List<Setor> getList() {
		return getEntityManager().createQuery("Select s From Setor s").getResultList();
	}
	
	@SuppressWarnings("unchecked")
	public List<Setor> list(Sitio sitio) {
		return getEntityManager().createQuery("Select s From Setor s where s.sitio = ?").setParameter(1,sitio).getResultList();
	}

	public Setor select(Long nu_setor) throws Exception {
		return getEntityManager().find(Setor.class,nu_setor);
	}

}